Skip to content

Batch saas synchronous api 2#266

Open
immunochomik wants to merge 3 commits into
mainfrom
batch-saas-synchronous-api-2
Open

Batch saas synchronous api 2#266
immunochomik wants to merge 3 commits into
mainfrom
batch-saas-synchronous-api-2

Conversation

@immunochomik

Copy link
Copy Markdown

Summary

Documents the new synchronous Batch API, which lets clients block for a job result via a wait query parameter
instead of polling. Covers all three affected endpoints and adds a task-oriented how-to page. SaaS on Cloud only.

Changes

API reference (spec/batch.yaml)

  • POST /jobs: new wait (integer seconds, capped server-side) and format (json-v2 | txt | srt, default json-v2)
    query params. Extended CreateJobResponse with an opt-in status field (created | done | rejected | deleted) and
    json-v2/txt/srt keys carrying the embedded transcript. status is present only when wait is set, so the schema stays
    backward-compatible.
  • GET /jobs/{jobid}: new wait query param. Always returns 200 in the job's current state; retryable.
  • GET /jobs/{jobid}/transcript: new wait query param. Returns 200 with the transcript if ready within the wait,
    otherwise the usual 404; retryable.

Docs

  • New how-to page speech-to-text/batch/synchronous.mdx: create-and-wait, wait-on-status, wait-on-transcript, the
    status outcome table, and the best-effort embedded-transcript fallback.
  • Added it to the Batch sidebar after Output.
  • Cross-linked from the Output page.

@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 23, 2026 2:10pm

Request Review

@immunochomik immunochomik requested a review from mnemitz June 23, 2026 14:10

@mnemitz mnemitz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few minor questions/suggestions!

@@ -0,0 +1,120 @@
---
description: 'Block for a transcript in a single request instead of polling for job status.'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal opinion, but I find something like this clearer:

Suggested change
description: 'Block for a transcript in a single request instead of polling for job status.'
description: Wait for a transcription job to finish synchronously via HTTP

The `wait` query parameter blocks a request until the job reaches a terminal state, so you can get a transcript in one call instead of polling. It applies to job creation, job status, and transcript retrieval.

:::info
`wait` is available on SaaS on Cloud only. It is not available on on-prem deployments.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me this sounds like we'll never offer it, what do you think?

Suggested change
`wait` is available on SaaS on Cloud only. It is not available on on-prem deployments.
`wait` is available on SaaS on Cloud only. It is not currently available on on-prem deployments.


## Create a job and wait for the transcript

Pass `wait` to `POST /jobs` to block until the job finishes. Add `format` to choose the embedded transcript format (`json-v2`, `txt`, or `srt`; defaults to `json-v2`).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pass `wait` to `POST /jobs` to block until the job finishes. Add `format` to choose the embedded transcript format (`json-v2`, `txt`, or `srt`; defaults to `json-v2`).
Pass the `wait` query parameter to `POST /jobs` to block until the job finishes. Add `format` to choose the embedded transcript format (`json-v2`, `txt`, or `srt`; defaults to `json-v2`).


# Synchronous transcription

The `wait` query parameter blocks a request until the job reaches a terminal state, so you can get a transcript in one call instead of polling. It applies to job creation, job status, and transcript retrieval.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good to spell out the full breadth of the feature from the top for clarity. Maybe something like this:

Suggested change
The `wait` query parameter blocks a request until the job reaches a terminal state, so you can get a transcript in one call instead of polling. It applies to job creation, job status, and transcript retrieval.
The `wait` query parameter lets you block a job request until either:
- The job enters a terminal state (`done` or `rejected`)
- The specified number of seconds elapses.
This allows you to avoid polling the API for job completion. The `wait` parameter can be used for several endpoints: i.e. creating a job, fetching job details, and fetching the full transcript.

}
```

`status` reports the outcome of the wait, which is distinct from the [job lifecycle status](/speech-to-text/batch/output#check-single-job-status):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused about this, I thought status would always return the current status of the job? Or is it just in the case of created after wait that it may be different?

Comment thread spec/batch.yaml
description: >-
**Note**: Only available on SaaS on Cloud.

Number of seconds to block until the job reaches a terminal state before responding. Capped server-side. When set, the response includes a `status` field reporting the outcome, and on `done` the transcript is embedded under the requested `format` key when available. When omitted, the request returns as soon as the job is created and `status` is not included.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly there is a possibility of timeout if someone specifies a very long wait time (like several hours). Is it worth communicating an upper limit either in the spec or in the doc page?

Comment on lines +26 to +27
<br/>
To get a transcript in a single blocking call instead of polling, see [Synchronous transcription](/speech-to-text/batch/synchronous).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small things on this tip block:

  1. Avoid <br/> inside an admonition. It's fragile MDX — the new sentence hangs in the tip without paragraph spacing. Cleaner as two separate paragraphs (blank line between them), or split into two admonitions: :::info for "you can also block with synchronous mode" (a routing hint rather than a tip), and keep :::tip for the notifications mention.

  2. The intro at line 22 ("Transcription jobs are processed asynchronously…") now reads as half-true given this PR ships a blocking option. Suggest softening to "Transcription jobs are processed asynchronously by default…" or rephrasing to acknowledge both polling and the new synchronous option.

(Refs: style guide — admonition usage; AI-readability — opening sentence names the subject accurately.)

Comment on lines +1 to +3
---
description: 'Block for a transcript in a single request instead of polling for job status.'
---

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing title: in the frontmatter — only description: is set. The style guide requires both title and description on every page (AI-readability standards). Docusaurus falls back to the H1, so the page currently renders fine, but explicit frontmatter keeps search, retrieval, and page metadata consistent across the site.

Suggest:

---
title: Synchronous transcription
description: Block for a transcript in a single request instead of polling for job status.
---

@petemomo

Copy link
Copy Markdown
Collaborator

One follow-up not in this diff: docs/speech-to-text/index.mdx still describes Batch as "asynchronously" in its intro, the same way the Output page does. With synchronous mode shipping here, that line is now incomplete on the higher-level overview too.

No need to expand the scope of this PR — happy for it to be a separate follow-up if you'd rather keep this one focused on the Batch section.

@petemomo petemomo self-requested a review June 23, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants